package com.work.keep.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.work.keep.R;

import java.util.List;

/**
 * Created by dllo on 16/1/21.
 */
public class MyHomePageFragmentAdapter extends FragmentPagerAdapter {
    private Context context;
    private List<Fragment> fragments;
    private String str[] = {"训练", "动态","我"};

    public MyHomePageFragmentAdapter(FragmentManager fm, Context context, List<Fragment> fragments) {
        super(fm);
        this.context = context;
        this.fragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    public View getTabView(int position) {
        View v = LayoutInflater.from(context).inflate(R.layout.activity_homepage_tabs, null);
        TextView tab = (TextView) v.findViewById(R.id.homePageTabTV);
        tab.setText(str[position]);
        return v;
    }
}
